package us.feng.tinyspring.beans.factory.support;

import us.feng.tinyspring.io.ResourceLoader;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import us.feng.tinyspring.beans.factory.xml.BeanDefinitionParserDelegate;
import us.feng.tinyspring.io.Resource;

public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {

	private BeanDefinitionRegistry registry;

	private ResourceLoader resourceLoader;

	public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
		this.registry=registry;
	}

	/**
	 * @see us.feng.tinyspring.beans.factory.support.BeanDefinitionReader#getRegistry()
	 */
	public BeanDefinitionRegistry getRegistry() {
		return this.registry;
	}


	/**
	 * @see us.feng.tinyspring.beans.factory.support.BeanDefinitionReader#getResourceLoader()
	 */
	public ResourceLoader getResourceLoader() {
		return this.resourceLoader;
	}
	
	public int loadBeanDefinitions(Resource []resources){
		int count=0;
		for(Resource resource:resources){
			count+=loadBeanDefinitions(resource);
		}
		return count;
	}
}
